'''
  封装member模块中的方法
'''
from futureloan.caw.baseRequests import BaseRequests
from futureloan.data import env


def register(br, cs):
    '''
    :param br: BaseRequests的实例
    :param cs: 参数
    :return: 响应
    '''
    url = env.url + "/futureloan/mvc/api/member/register"
    r = br.post(url, data=cs)
    return r.json()


def login(br, cs):
    url = env.url + "/futureloan/mvc/api/member/login"
    r = br.post(url, data=cs)
    return r.json()


def list(br):
    url = env.url + "/futureloan/mvc/api/member/list"
    r = br.get(url)
    return r.json()


def recharge(br, cs):
    url = env.url + "/futureloan/mvc/api/member/recharge"
    r = br.post(url, data=cs)
    return r.json()


def withdraw(br, cs):
    url = env.url + "/futureloan/mvc/api/member/withdraw"
    r = br.post(url, data=cs)
    return r.json()


# 测试代码，用完删除
if __name__ == '__main__':
    br = BaseRequests()
    register(br, {"mobilephone": 18012345678, "pwd": 123456})
